Subject: Re: How to detatch from cli.
From: [email-masked] (Arno Eigenwillig)
Date: Tue, 08 Feb 1994 15:44:25 +0100
Newsgroups: comp.sys.amiga.programmer

Hi!

In article <[email-masked]>,
	[email-masked] (Mark Brophy) writes:

> 	can someone enlighten me on how to detatch from the cli
> 	in a C program. At the moment I'm forkl() ing which
> 	seems a little like overkill???

1. The first code hunk of your program should be a little assembler
routine which backups the pointer to the next segment, zeroes the
original pointer, creates a new process with the backuped pointer, and
terminates.

2. Alternatively, it is said that zeroing the cli_Module field in the
CommandLineInterface structure BCPL-pointed to by a CLI process' pr_CLI
will prevent the DOS from unloading any of your code so that you may use
a technique like described above to keep your whole program in memory,
malking a HLL implementation of auto detaching easier.

3. Although Ralph Babel's excellent Amiga Guru Book documents both
methods above, he suggests RUNning the program as the most compatible
way, although having a program RUN itself implies just the overhead you
wanted to avoid in the first place.

Any comments welcome.

--                  __                            __
Arno Eigenwillig __/// [email-masked]     __/// FIDO-Net (untested)
++49-2225-5870   \XX/  [email-masked] \XX/ 2:2402/330.99  2:2440/99

Objects may be divided up in three categories: malfunctioning objects,
objects getting broken and objects getting lost. [Russel Baker]